package cn.edu.zut.cs.Business;

import cn.edu.zut.cs.DAO.StudentDAO;
import cn.edu.zut.cs.Model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service

public class StudentService {
    @Autowired
    StudentDAO studentDAO;




    /* public void setBookDAO(BookDAO bookDAO)
     {
         this.bookDAO =bookDAO;

     }*/
    public void insert(Student student)
    {
        studentDAO.insertStudent(student);
    }
    @Transactional
    public void modify(float score)
    {
        List<Student> StudentList=studentDAO.queryAll();
        for(Student b : StudentList)
        {
            b.setScore(score);
            studentDAO.modifyStudent(b);
        }
    }
}
